import { S } from '../../s';
import { IPSApplication } from '../ipsapplication';
import { IPSAppCounterRef } from '../control/ipsapp-counter-ref';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppView } from './ipsapp-view';
import { IPSAppViewEngine } from './ipsapp-view-engine';
import { IPSAppViewLogic } from './ipsapp-view-logic';
import { IPSAppViewMsgGroup } from './ipsapp-view-msg-group';
import { IPSAppViewNavContext } from './ipsapp-view-nav-context';
import { IPSAppViewNavParam } from './ipsapp-view-nav-param';
import { IPSAppViewParam } from './ipsapp-view-param';
import { IPSAppViewRef } from './ipsapp-view-ref';
import { IPSAppViewUIAction } from './ipsapp-view-uiaction';
import { IPSControl } from '../../control/ipscontrol';
import { IPSViewLayoutPanel } from '../../control/panel/ipsview-layout-panel';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppViewImpl extends PSModelObjectImpl implements IPSAppView {
  get accUserMode(): 0 | 2 | 3 | 4 {
    return this.M.accUserMode;
  }

  get accessKey(): string {
    return this.M.accessKey;
  }

  protected cappslanguageres: IPSLanguageRes;
  getCapPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.cappslanguageres ||
      (this.cappslanguageres = this.fillObjectModel(
        S._276,
        this.M.getCapPSLanguageRes,
        S._2a8,
      ) as IPSLanguageRes)
    );
  }

  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get fullCodeName(): string {
    return this.M.fullCodeName;
  }

  get height(): number {
    return this.M.height != null ? this.M.height : 0;
  }

  get mainMenuAlign():
    | 'LEFT'
    | 'TOP'
    | 'CENTER'
    | 'TREEEXP'
    | 'TABEXP_TOP'
    | 'TABEXP_LEFT'
    | 'TABEXP_BOTTOM'
    | 'TABEXP_RIGHT'
    | 'NONE' {
    return this.M.mainMenuAlign;
  }

  get openMode():
    | 'INDEXVIEWTAB'
    | 'POPUP'
    | 'POPUPMODAL'
    | 'POPUPAPP'
    | 'DRAWER_LEFT'
    | 'DRAWER_RIGHT'
    | 'DRAWER_TOP'
    | 'DRAWER_BOTTOM'
    | 'POPOVER'
    | 'USER'
    | 'USER2'
    | 'USER3'
    | 'USER4' {
    return this.M.openMode;
  }

  protected psappcounterrefs: IPSAppCounterRef[];
  getPSAppCounterRefs(): IPSAppCounterRef[] | null {
    return (
      this.psappcounterrefs ||
      (this.psappcounterrefs = this.fillChildListModel(
        this.M.getPSAppCounterRefs,
        S._9d,
      ) as IPSAppCounterRef[])
    );
  }

  findPSAppCounterRef(objKey: any): IPSAppCounterRef | null {
    return this.getPSModel5(
      S._9d,
      this.getPSAppCounterRefs(),
      objKey,
    ) as IPSAppCounterRef;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }

  protected psappviewengines: IPSAppViewEngine[];
  getPSAppViewEngines(): IPSAppViewEngine[] | null {
    return (
      this.psappviewengines ||
      (this.psappviewengines = this.fillChildListModel(
        this.M.getPSAppViewEngines,
        S._296,
      ) as IPSAppViewEngine[])
    );
  }

  findPSAppViewEngine(objKey: any): IPSAppViewEngine | null {
    return this.getPSModel5(
      S._296,
      this.getPSAppViewEngines(),
      objKey,
    ) as IPSAppViewEngine;
  }

  protected psappviewlogics: IPSAppViewLogic[];
  getPSAppViewLogics(): IPSAppViewLogic[] | null {
    return (
      this.psappviewlogics ||
      (this.psappviewlogics = this.fillChildListModel(
        this.M.getPSAppViewLogics,
        S._82,
      ) as IPSAppViewLogic[])
    );
  }

  findPSAppViewLogic(objKey: any): IPSAppViewLogic | null {
    return this.getPSModel5(
      S._82,
      this.getPSAppViewLogics(),
      objKey,
    ) as IPSAppViewLogic;
  }

  protected psappviewmsggroup: IPSAppViewMsgGroup;
  getPSAppViewMsgGroup(): IPSAppViewMsgGroup | null {
    if (this.psappviewmsggroup != null) return this.psappviewmsggroup;
    const value = this.M.getPSAppViewMsgGroup;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappviewmsggroup = ipsapplication.findPSAppViewMsgGroup(value);
    }
    return this.psappviewmsggroup;
  }

  protected psappviewnavcontexts: IPSAppViewNavContext[];
  getPSAppViewNavContexts(): IPSAppViewNavContext[] | null {
    return (
      this.psappviewnavcontexts ||
      (this.psappviewnavcontexts = this.fillChildListModel(
        this.M.getPSAppViewNavContexts,
        S._8b,
      ) as IPSAppViewNavContext[])
    );
  }

  findPSAppViewNavContext(objKey: any): IPSAppViewNavContext | null {
    return this.getPSModel5(
      S._8b,
      this.getPSAppViewNavContexts(),
      objKey,
    ) as IPSAppViewNavContext;
  }

  protected psappviewnavparams: IPSAppViewNavParam[];
  getPSAppViewNavParams(): IPSAppViewNavParam[] | null {
    return (
      this.psappviewnavparams ||
      (this.psappviewnavparams = this.fillChildListModel(
        this.M.getPSAppViewNavParams,
        S._89,
      ) as IPSAppViewNavParam[])
    );
  }

  findPSAppViewNavParam(objKey: any): IPSAppViewNavParam | null {
    return this.getPSModel5(
      S._89,
      this.getPSAppViewNavParams(),
      objKey,
    ) as IPSAppViewNavParam;
  }

  protected psappviewparams: IPSAppViewParam[];
  getPSAppViewParams(): IPSAppViewParam[] | null {
    return (
      this.psappviewparams ||
      (this.psappviewparams = this.fillChildListModel(
        this.M.getPSAppViewParams,
        S._88,
      ) as IPSAppViewParam[])
    );
  }

  findPSAppViewParam(objKey: any): IPSAppViewParam | null {
    return this.getPSModel5(
      S._88,
      this.getPSAppViewParams(),
      objKey,
    ) as IPSAppViewParam;
  }

  protected psappviewrefs: IPSAppViewRef[];
  getPSAppViewRefs(): IPSAppViewRef[] | null {
    return (
      this.psappviewrefs ||
      (this.psappviewrefs = this.fillChildListModel(
        this.M.getPSAppViewRefs,
        S._8d,
      ) as IPSAppViewRef[])
    );
  }

  findPSAppViewRef(objKey: any): IPSAppViewRef | null {
    return this.getPSModel5(
      S._8d,
      this.getPSAppViewRefs(),
      objKey,
    ) as IPSAppViewRef;
  }

  protected psappviewuiactions: IPSAppViewUIAction[];
  getPSAppViewUIActions(): IPSAppViewUIAction[] | null {
    return (
      this.psappviewuiactions ||
      (this.psappviewuiactions = this.fillChildListModel(
        this.M.getPSAppViewUIActions,
        S._8e,
      ) as IPSAppViewUIAction[])
    );
  }

  findPSAppViewUIAction(objKey: any): IPSAppViewUIAction | null {
    return this.getPSModel5(
      S._8e,
      this.getPSAppViewUIActions(),
      objKey,
    ) as IPSAppViewUIAction;
  }

  protected pscontrols: IPSControl[];
  getPSControls(): IPSControl[] | null {
    return (
      this.pscontrols ||
      (this.pscontrols = this.fillChildListModel(
        this.M.getPSControls,
        S._214,
      ) as IPSControl[])
    );
  }

  findPSControl(objKey: any): IPSControl | null {
    return this.getPSModel5(S._214, this.getPSControls(), objKey) as IPSControl;
  }

  protected pssyscss: IPSSysCss;
  getPSSysCss(): IPSSysCss | null {
    return (
      this.pssyscss ||
      (this.pssyscss = this.fillObjectModel(
        S._278,
        this.M.getPSSysCss,
        S._2ac,
      ) as IPSSysCss)
    );
  }

  protected pssysimage: IPSSysImage;
  getPSSysImage(): IPSSysImage | null {
    return (
      this.pssysimage ||
      (this.pssysimage = this.fillObjectModel(
        S._27b,
        this.M.getPSSysImage,
        S._2ad,
      ) as IPSSysImage)
    );
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  protected psviewlayoutpanel: IPSViewLayoutPanel;
  getPSViewLayoutPanel(): IPSViewLayoutPanel | null {
    return (
      this.psviewlayoutpanel ||
      (this.psviewlayoutpanel = this.fillObjectModel(
        S._25a,
        this.M.getPSViewLayoutPanel,
        S._2cf,
      ) as IPSViewLayoutPanel)
    );
  }

  get priority(): number {
    return this.M.priority != null ? this.M.priority : -1;
  }

  get refFlag(): boolean {
    return this.M.refFlag != null ? this.M.refFlag : true;
  }

  protected refpsappview: IPSAppView;
  getRefPSAppView(): IPSAppView | null {
    return (
      this.refpsappview ||
      (this.refpsappview = this.fillObjectModel(
        S._1e,
        this.M.getRefPSAppView,
        S._2af,
      ) as IPSAppView)
    );
  }

  protected subcappslanguageres: IPSLanguageRes;
  getSubCapPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.subcappslanguageres ||
      (this.subcappslanguageres = this.fillObjectModel(
        S._276,
        this.M.getSubCapPSLanguageRes,
        S._2b0,
      ) as IPSLanguageRes)
    );
  }

  get subCaption(): string {
    return this.M.subCaption;
  }

  get title(): string {
    return this.M.title;
  }

  protected titlepslanguageres: IPSLanguageRes;
  getTitlePSLanguageRes(): IPSLanguageRes | null {
    return (
      this.titlepslanguageres ||
      (this.titlepslanguageres = this.fillObjectModel(
        S._276,
        this.M.getTitlePSLanguageRes,
        S._2b1,
      ) as IPSLanguageRes)
    );
  }

  get viewStyle():
    | 'DEFAULT'
    | 'STYLE2'
    | 'STYLE3'
    | 'STYLE4'
    | 'STYLE5'
    | 'STYLE6'
    | 'STYLE7'
    | 'STYLE8'
    | 'STYLE9'
    | 'STYLE10'
    | 'PREVIEW' {
    return this.M.viewStyle;
  }

  get viewType():
    | 'APPDATAUPLOADVIEW'
    | 'APPERRORVIEW'
    | 'APPFILEUPLOADVIEW'
    | 'APPFUNCPICKUPVIEW'
    | 'APPINDEXVIEW'
    | 'APPLOGINVIEW'
    | 'APPLOGOUTVIEW'
    | 'APPPANELVIEW'
    | 'APPPICUPLOADVIEW'
    | 'APPPORTALVIEW'
    | 'APPREDIRECTVIEW'
    | 'APPSTARTVIEW'
    | 'APPWELCOMEVIEW'
    | 'APPWFADDSTEPAFTERVIEW'
    | 'APPWFADDSTEPBEFOREVIEW'
    | 'APPWFREDIRECTVIEW'
    | 'APPWFSENDBACKVIEW'
    | 'APPWFSTEPACTORVIEW'
    | 'APPWFSTEPDATAVIEW'
    | 'APPWFSTEPTRACEVIEW'
    | 'APPWFSUPPLYINFOVIEW'
    | 'APPWFTAKEADVICEVIEW'
    | 'DECALENDAREXPVIEW'
    | 'DECALENDARVIEW'
    | 'DECALENDARVIEW9'
    | 'DECHARTEXPVIEW'
    | 'DECHARTVIEW'
    | 'DECHARTVIEW9'
    | 'DECUSTOMVIEW'
    | 'DEDATAVIEW'
    | 'DEDATAVIEW9'
    | 'DEDATAVIEWEXPVIEW'
    | 'DEEDITVIEW'
    | 'DEEDITVIEW2'
    | 'DEEDITVIEW3'
    | 'DEEDITVIEW4'
    | 'DEEDITVIEW9'
    | 'DEFORMPICKUPDATAVIEW'
    | 'DEGANTTEXPVIEW'
    | 'DEGANTTVIEW'
    | 'DEGANTTVIEW9'
    | 'DEGRIDEXPVIEW'
    | 'DEGRIDVIEW'
    | 'DEGRIDVIEW2'
    | 'DEGRIDVIEW4'
    | 'DEGRIDVIEW8'
    | 'DEGRIDVIEW9'
    | 'DEHTMLVIEW'
    | 'DEINDEXPICKUPDATAVIEW'
    | 'DEINDEXVIEW'
    | 'DEKANBANVIEW'
    | 'DEKANBANVIEW9'
    | 'DELISTEXPVIEW'
    | 'DELISTVIEW'
    | 'DELISTVIEW9'
    | 'DEMAPEXPVIEW'
    | 'DEMAPVIEW'
    | 'DEMAPVIEW9'
    | 'DEMDCUSTOMVIEW'
    | 'DEMEDITVIEW9'
    | 'DEMOBCALENDAREXPVIEW'
    | 'DEMOBCALENDARVIEW'
    | 'DEMOBCALENDARVIEW9'
    | 'DEMOBCHARTEXPVIEW'
    | 'DEMOBCHARTVIEW'
    | 'DEMOBCHARTVIEW9'
    | 'DEMOBCUSTOMVIEW'
    | 'DEMOBDATAVIEW'
    | 'DEMOBDATAVIEWEXPVIEW'
    | 'DEMOBEDITVIEW'
    | 'DEMOBEDITVIEW3'
    | 'DEMOBEDITVIEW9'
    | 'DEMOBFORMPICKUPMDVIEW'
    | 'DEMOBGANTTEXPVIEW'
    | 'DEMOBGANTTVIEW'
    | 'DEMOBGANTTVIEW9'
    | 'DEMOBHTMLVIEW'
    | 'DEMOBINDEXPICKUPMDVIEW'
    | 'DEMOBLISTEXPVIEW'
    | 'DEMOBLISTVIEW'
    | 'DEMOBMAPEXPVIEW'
    | 'DEMOBMAPVIEW'
    | 'DEMOBMAPVIEW9'
    | 'DEMOBMDVIEW'
    | 'DEMOBMDVIEW9'
    | 'DEMOBMEDITVIEW9'
    | 'DEMOBMPICKUPVIEW'
    | 'DEMOBOPTVIEW'
    | 'DEMOBPANELVIEW'
    | 'DEMOBPANELVIEW9'
    | 'DEMOBPICKUPLISTVIEW'
    | 'DEMOBPICKUPMDVIEW'
    | 'DEMOBPICKUPTREEVIEW'
    | 'DEMOBPICKUPVIEW'
    | 'DEMOBPORTALVIEW'
    | 'DEMOBPORTALVIEW9'
    | 'DEMOBREDIRECTVIEW'
    | 'DEMOBREPORTVIEW'
    | 'DEMOBTABEXPVIEW'
    | 'DEMOBTABEXPVIEW9'
    | 'DEMOBTABSEARCHVIEW'
    | 'DEMOBTABSEARCHVIEW9'
    | 'DEMOBTREEEXPVIEW'
    | 'DEMOBTREEEXPVIEW9'
    | 'DEMOBTREEVIEW'
    | 'DEMOBWFACTIONVIEW'
    | 'DEMOBWFDATAREDIRECTVIEW'
    | 'DEMOBWFDYNAACTIONVIEW'
    | 'DEMOBWFDYNAEDITVIEW'
    | 'DEMOBWFDYNAEDITVIEW3'
    | 'DEMOBWFDYNAEXPMDVIEW'
    | 'DEMOBWFDYNASTARTVIEW'
    | 'DEMOBWFEDITVIEW'
    | 'DEMOBWFEDITVIEW3'
    | 'DEMOBWFMDVIEW'
    | 'DEMOBWFPROXYRESULTVIEW'
    | 'DEMOBWFPROXYSTARTVIEW'
    | 'DEMOBWFSTARTVIEW'
    | 'DEMOBWIZARDVIEW'
    | 'DEMPICKUPVIEW'
    | 'DEMPICKUPVIEW2'
    | 'DEOPTVIEW'
    | 'DEPANELVIEW'
    | 'DEPANELVIEW9'
    | 'DEPICKUPDATAVIEW'
    | 'DEPICKUPGRIDVIEW'
    | 'DEPICKUPTREEVIEW'
    | 'DEPICKUPVIEW'
    | 'DEPICKUPVIEW2'
    | 'DEPICKUPVIEW3'
    | 'DEPORTALVIEW'
    | 'DEPORTALVIEW9'
    | 'DEREDIRECTVIEW'
    | 'DEREPORTVIEW'
    | 'DETABEXPVIEW'
    | 'DETABEXPVIEW9'
    | 'DETABSEARCHVIEW'
    | 'DETABSEARCHVIEW9'
    | 'DETREEEXPVIEW'
    | 'DETREEEXPVIEW2'
    | 'DETREEEXPVIEW3'
    | 'DETREEGRIDEXVIEW'
    | 'DETREEGRIDEXVIEW9'
    | 'DETREEGRIDVIEW'
    | 'DETREEGRIDVIEW9'
    | 'DETREEVIEW'
    | 'DETREEVIEW9'
    | 'DEWFACTIONVIEW'
    | 'DEWFDATAREDIRECTVIEW'
    | 'DEWFDYNAACTIONVIEW'
    | 'DEWFDYNAEDITVIEW'
    | 'DEWFDYNAEDITVIEW3'
    | 'DEWFDYNAEXPGRIDVIEW'
    | 'DEWFDYNASTARTVIEW'
    | 'DEWFEDITPROXYDATAVIEW'
    | 'DEWFEDITVIEW'
    | 'DEWFEDITVIEW2'
    | 'DEWFEDITVIEW3'
    | 'DEWFEDITVIEW9'
    | 'DEWFEXPVIEW'
    | 'DEWFGRIDVIEW'
    | 'DEWFPROXYDATAVIEW'
    | 'DEWFPROXYRESULTVIEW'
    | 'DEWFPROXYSTARTVIEW'
    | 'DEWFSTARTVIEW'
    | 'DEWIZARDVIEW'
    | 'DESUBAPPREFVIEW' {
    return this.M.viewType;
  }

  get width(): number {
    return this.M.width != null ? this.M.width : 0;
  }

  get enableDP(): boolean {
    return this.M.enableDP;
  }

  get enableWF(): boolean {
    return this.M.enableWF != null ? this.M.enableWF : false;
  }

  get pickupMode(): boolean {
    return this.M.pickupMode != null ? this.M.pickupMode : false;
  }

  get redirectView(): boolean {
    return this.M.redirectView != null ? this.M.redirectView : false;
  }

  get showCaptionBar(): boolean {
    return this.M.showCaptionBar != null ? this.M.showCaptionBar : true;
  }
  get cls(): string {
    return 'PSAppViewImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._1e || cls == S._1f) return true;
    return super.instanceof(cls);
  }
}
